#ifndef DATA_STRUCTURES_H
#define DATA_STRUCTURES_H


/*
This file is used to implement the data structures used in the code.
Those are very implementation specific data structures that designed specificly for curcent project.
*/

typedef struct Packet {
	int arrival_time, arrival_port, destination_port, leave_time; //packet information
	struct Packet * next; //pointer to next packet in queue
} Packet; //represents a packet, that also is a node of a packets queue


typedef struct {
	Packet * head;
	Packet * current;
	int size;
} Queue; //Struct represents queue of packets

typedef struct ListNode {
	int val;
	struct ListNode * prev;
	struct ListNode * next;
} ListNode; //list node

typedef struct {
	ListNode * head;
	ListNode * tail;
	ListNode * curr;
	int size; 
} List; //represents linked list, used for requests and grants lists


void initList(List * list); //initializes list
void pushBack(List * list, int val); //pushed value to the end of the list
void destroyList(List * list); //deletes all elements

void initQueue(Queue * queue); // initializes queue
void initQueues(Queue * queues, int N); //initializes array of queues
void destroyQueue(Queue * queue); //removes all elemtents
void insertToQueue(Queue * queue, Packet * packet); //puts a new packet into the queue
Packet * popQueue(Queue * queue); //removes packet from the head of the queue and returns its

#endif